package com.taotao.web.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import com.fasterxml.jackson.core.type.TypeReference;
import com.taotao.common.pojo.CommonResult;
import com.taotao.common.service.HttpClientService;
import com.taotao.web.pojo.Order;

@Service
public class OrderService {

	@Autowired
	private HttpClientService httpClientService;

	@Value("${TAOTAO_ORDER_CREATE}")
	private String TAOTAO_ORDER_CREATE;

	public CommonResult createOrder(Order order) {
		return this.httpClientService.doPostJson(TAOTAO_ORDER_CREATE, order, new TypeReference<CommonResult>() {
		});
	}

	public Order queryOrderById(String orderId) {
		return this.httpClientService.doGet("http://order.taotao.com/order/query/" + orderId,
				new TypeReference<Order>() {
				});
	}

}
